package org.example.springboot.prop;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@SpringBootApplication
public class SpringbootPropApp {

    @Resource// @Autowired
    private UserConfig userConfig;

    @RequestMapping("/hello")
    public String sayHello() {
        return userConfig.getUserName();
    }

    @Resource// @Autowired
    private UserProperties userProperties;

    @RequestMapping("/hello2")
    public UserProperties sayHello2() {
        return userProperties;
    }

    public static void main(String[] args) {
        SpringApplication.run (SpringbootPropApp.class, args);
    }
}
